<template>
	<view class="wrap" style="padding-bottom: 60px;">
		<u-cell-group :border="false">
			<u-gap height="20" bg-color="#f5f5f5" />
			<u-cell-item title="头像" :arrow="true" @click="chooseAvatar">
				<u-avatar size="60" bg-color='#000;' :src="info.avatar"
					style="position: absolute;right: 40px;top:12px;" />
			</u-cell-item>
			<u-cell-item title="账号类型" :value="info.rid===101?'普通会员':'健身教练'" :title-width="180" :arrow="false" />
			<u-cell-item title="昵称" :value="info.nickname" :title-width="180" :arrow="true"
				@click="navTo('/pages/sys/user/modify')" />
			<u-cell-item title="性别" value="男" :title-width="180" :arrow="true" />
			<u-cell-item title="地址" :value="info.address" :title-width="180" :arrow="true" />
			<u-cell-item title="手机" :value="info.phone" :title-width="180" />
			<u-cell-item title="微信" :value="info.weixin?info.weixin:''" :title-width="180" :arrow="true" />
			<u-cell-item title="邮箱" :value="info.email?info.email:''" :title-width="180" :arrow="true" />
			<u-gap height="20" bg-color="#f5f5f5" />
		</u-cell-group>
		<view>
			<u-button class="sign-out" @click="logout" :hair-line="false">退出登录</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {}
			};
		},
		onLoad() {
			this.info = this.vuex_user
		},

		methods: {
			navTo(url) {
				uni.navigateTo({
					url: url
				});
			},
			chooseAvatar() {
				this.$u.toast("更换头像")
			},
			logout() {
				this.$u.vuex('vuex_user', {})
				this.$u.vuex('vuex_token', '')
				setTimeout(() => {
					uni.reLaunch({
						url: '/pages/sys/login/index'
					});
				}, 500);
			}
		}
	};
</script>

<style lang="scss" scoped>
	page {
		background: #f5f5f5;
	}

	.u-form {
		background: #fff;
		padding: 0 15px;
	}

	.u-size-medium {
		height: 60rpx;
		line-height: 60rpx;
		padding: 0 20px;
		font-size: 28rpx;
		background-color: rgba(0, 0, 0, 0.1);
		color: #fff;
		border: 1px solid #5186e7;
	}

	.u-hairline-border:after {
		border: 1px solid #5186e7 !important;
	}

	.input-placeholder {
		text-align: right;
	}

	.u-input {
		text-align: right !important;
	}

	.u-form-item {
		font-size: 36rpx;
	}
</style>
